//package com.alibaba.citrus.cr.order.open.api.facade.config;
//
//import com.alibaba.citrus.cr.order.open.api.facade.listener.ShippingOrderCreatedMessageListener;
//import com.alibaba.fastjson.JSON;
//import com.aliyun.openservices.ons.api.MessageListener;
//import com.aliyun.openservices.ons.api.ONSFactory;
//import com.aliyun.openservices.ons.api.PropertyKeyConst;
//import com.aliyun.openservices.ons.api.bean.ConsumerBean;
//import com.aliyun.openservices.ons.api.bean.OrderConsumerBean;
//import com.aliyun.openservices.ons.api.bean.Subscription;
//import com.aliyun.openservices.ons.api.order.MessageOrderListener;
//import com.aliyun.openservices.ons.api.order.OrderConsumer;
//import com.google.common.collect.Maps;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.util.Map;
//import java.util.Properties;
//
///**
// * @description:
// * @author: yuhw
// * @date: 2024年01月07日 21:23
// **/
////@Component
//@Configuration
//public class ConsumerClient {
//    @Resource
//    private MQConfig mqConfig;
//    @Resource
//    private ShippingOrderCreatedMessageListener shippingOrderCreatedMessageListener;
//
//
//    @Bean(initMethod = "start", destroyMethod = "shutdown")
//    public ConsumerBean buildOrderConsumer(){
////        ConsumerBean consumerBean = new OrderConsumerBean();
//        Properties properties = mqConfig.getProperties();
//        properties.put(PropertyKeyConst.GROUP_ID,mqConfig.getShippingOrderCreatedGroupId());
//        properties.put(PropertyKeyConst.ConsumeThreadNums,10);
//        ConsumerBean consumerBean = new ConsumerBean();
//        consumerBean.setProperties(properties);
//
//        System.out.println(JSON.toJSONString(shippingOrderCreatedMessageListener));
//        System.out.println(shippingOrderCreatedMessageListener);
////        shippingOrderCreatedMessageListener.sing();
//        Map<Subscription, MessageListener> subscriptionTable = Maps.newHashMap();
//        Subscription subscription = new Subscription();
//        subscription.setTopic(mqConfig.getShippingOrderCreatedTopic());
//        subscription.setExpression(mqConfig.getShippingOrderCreatedTag());
//        subscriptionTable.put(subscription,shippingOrderCreatedMessageListener);
//        consumerBean.setSubscriptionTable(subscriptionTable);
//        return consumerBean;
//////        consumerBean.setProperties(properties);
////        OrderConsumer orderConsumer = ONSFactory.createOrderedConsumer(properties);
////        orderConsumer.subscribe(mqConfig.getShippingOrderCreatedTopic(),mqConfig.getShippingOrderCreatedTag(),
////                shippingOrderCreatedMessageListener);
////        return orderConsumer;
////        Subscription shippingOrderCreatedSubscription = new Subscription();
////        shippingOrderCreatedSubscription.setTopic(mqConfig.getShippingOrderCreatedTopic());
////        shippingOrderCreatedSubscription.setExpression("*");
////        Map<Subscription, MessageListener> subscriptionMap = Maps.newHashMap();
////        subscriptionMap.put(shippingOrderCreatedSubscription,shippingOrderCreatedMessageListener)
////        consumerBean.sub
//    }
//}
